﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RMS
{
    public partial class frmEnableSalePriceMng : Form
    {
        public frmEnableSalePriceMng()
        {
            InitializeComponent();
        }

        private void btnSave2_Click(object sender, EventArgs e)
        {
            string code = System.IO.File.ReadAllText(Constants.VerifyAdminPath);
            var file = new System.IO.StreamWriter(Constants.VerifyAdminPath);
            try
            {
                var arr = code.Split('#');
                if (checkBox1.Checked)
                    file.Write(arr[0] + "#" + arr[1] + "#1#" + arr[3]);
                if (!checkBox1.Checked)
                    file.Write(arr[0] + "#" + arr[1] + "#0#" + arr[3]);
                MessageBox.Show("Lưu thành công.");
            }
            finally
            {
                file.Close();
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void frmDiscountVIPMng_Load(object sender, EventArgs e)
        {
            try
            {
                string verifyCode = System.IO.File.ReadAllText(Constants.VerifyAdminPath);
                var arr = verifyCode.Split('#');
                if (arr[2] == "1")
                    checkBox1.Checked = true;
                if (arr[2] == "0")
                    checkBox1.Checked = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
        }
    }
}
